from appium.webdriver.common.appiumby import AppiumBy

from base.search_base import SearchBase
from test_cases.conftest import driver


class SearchPage(SearchBase):
    def search_bar_for_input_send(self, driver, value):
        search_bar_for_input_send_xpath = self.search_bar_for_input()
        return self.send_keys_new(driver, AppiumBy.XPATH, search_bar_for_input_send_xpath, value)

    def search_button_click(self, drvier):
        search_button_xpath = self.search_button()
        return self.click_new(drvier, AppiumBy.XPATH, search_button_xpath)

    def get_assert_value(self, driver):
        book_title_xpath = self.book_title()
        return self.get_text(driver, AppiumBy.XPATH, book_title_xpath)
